package com.joeyee.echartsgenerator.echarts.map;

import com.github.abel533.echarts.Title;
import com.github.abel533.echarts.code.SeriesType;
import com.github.abel533.echarts.code.X;
import com.github.abel533.echarts.json.GsonOption;
import com.github.abel533.echarts.series.Map;
import com.joeyee.echartsgenerator.echarts.EchartData;
import com.joeyee.echartsgenerator.echarts.EnhancedOption;

/**
 * @author Joe Yee
 * @version 1.0
 * @description: TODO
 * @date 2021/8/11 16:47
 */
public class EchartMap extends EchartData {

    public static GsonOption createMap(MapData mapData){
        EnhancedOption option = new EnhancedOption();
        /** 
         * @description: 设置背景色
         * @author Joe Yee
         * @date: 2021/8/11 16:49
         */ 
        option.setBackgroundColor("#FFFFFF");
        option.setTitle(new Title().text(mapData.getTitle()).x(X.center));
        Map map = new Map();
        map.name("数据");
        map.type(SeriesType.map);
        map.mapType("china");
        map.label().normal().show(true);
        map.label().emphasis().show(true);
        map.data(mapData.getData());
        option.series(map);
        return option;
    }
}
